<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;


class Comment extends Model
{
    use HasFactory;



    public function user(){
        return $this->belongsTo(User::class,'user_id','id');
    }
    public function write(){
        return $this->belongsTo(Write::class,'write_id','id');
    }
    public function children(){
        return $this->hasMany(Comment::class,'pid','id');

    }
    public function touser(){
        return $this->belongsTo(User::class,'touser_id','id');
    }
}
